package com.itheima.demo;

import com.itheima.domain.User;
import com.itheima.uitls.MapperUtil;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;

import java.util.ArrayList;
import java.util.List;

public class Demo4 {

    @Test
    public void test1(){
        SqlSession session = MapperUtil.getSession();
        List<User> list = session.selectList("com.itheima.mapper.UserMapper.test1",4);
    }

    @Test
    public void test2(){
        SqlSession session = MapperUtil.getSession();
        List<Integer> i=new ArrayList<Integer>();
       // i.add(1);
        List<User> list = session.selectList("com.itheima.mapper.UserMapper.test2",i);
    }

    @Test
    public void test3(){
        SqlSession session = MapperUtil.getSession();
        Integer[] i={1,2};
        List<User> list = session.selectList("com.itheima.mapper.UserMapper.test3",i);
    }

    @Test
    public void test4(){
        User u=new User();
        u.setId(7);
        u.setUsername("manager3");
        //u.setPwd("6668");

        SqlSession session = MapperUtil.getSession();
        session.update("com.itheima.mapper.UserMapper.test4",u);
        session.commit();
        session.close();
    }
}
